<!DOCTYPE HTML>
<html lang="zh-CN"><head>
	<title>{$name}</title>
	<meta charset="UTF-8">
	<meta name="viewport" content=" initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=no">
	<script src="https://og6593g2z.qnssl.com/fundebug.0.3.3.min.js" apikey="e65b1e28cd641345cd31ef6dce8ac62f7aaa3ba3420be5a1c4aa23ee3636992d"></script>
	<link href="{$Think.config.RESOURCEURL}wx_assets/micontent/materiaDetail.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
	<link href="{$Think.config.RESOURCEURL}wx_assets/css/common.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
	<link href="{$Think.config.RESOURCEURL}wx_assets/swiper/swiper.min.css{$Think.config.RESOURCE_VER}" rel="stylesheet" type="text/css">
	<link href="{$Think.config.RESOURCEURL}wx_assets/css/product/product_detail.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
	<if condition="$mallHue.mallHue eq '1'">
		<link href="{$Think.config.RESOURCEURL}wx_assets/css/product/new_detail_blue.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
		<else/>
		<link href="{$Think.config.RESOURCEURL}wx_assets/css/product/new_detail.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
	</if>
	<link href="//at.alicdn.com/t/font_247327_bb93xb90dm5i2j4i.css" rel="stylesheet" type="text/css">
	<link href="{$Think.config.RESOURCEURL}wx_assets/iconfont/iconfont.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
	<link href="{$Think.config.RESOURCEURL}wx_assets/css/iconfont/font_tuan.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
	<!-- <script src="http://sdk.talkingdata.com/app/h5/v1?appid=DE13C350F41F5DE78FEC51DB5DE730D1&vn=v2&vc=v2"></script> -->
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.1.1.3.min.js{$Think.config.RESOURCE_VER}"></script>
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/swiper/swiper.min.js{$Think.config.RESOURCE_VER}"></script>
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.alert.js{$Think.config.RESOURCE_VER}"></script>
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/wx_share.js{$Think.config.RESOURCE_VER}"></script>
	<script src="{$Think.config.RESOURCEURL}wx_assets/js/util.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/product/product.js{$Think.config.RESOURCE_VER}"></script>
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/product/cookie.js{$Think.config.RESOURCE_VER}"></script>
	<script src="{$Think.config.RESOURCEURL}wx_assets/js/product/timer.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>

	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/product/m_city.js{$Think.config.RESOURCE_VER}"></script>
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/product/z.citys.js{$Think.config.RESOURCE_VER}"></script>
	<style>
		.contact_container>.contact_card>.contact li{
			width:33.33%;
		}
	</style>
</head>
<body>
<!--关注浮层 begin-->
<!--0表示未关注，1表示已关注-->
<if condition="$subscribe eq '0'">
	<div class="careview">
		<img src="{$mall.logo}" alt="" />
		<a href='{$mall.wechaturl}'>立即关注</a>
		<empty name="mall.recommend">
			<p>{$mall.wechatname}</p>
			<else />
			<p>{$mall.recommend}</p>
		</empty>

		<span></span>
	</div>
	<script>

		$('.careview > span').on('click',function(){
			$('.careview').hide();
		});

	</script>
</if>
<!--关注浮层 end-->
<notempty name="headerTpl">
	<include file="$headerTpl" />
</notempty>
<!--<div class="shop-box">
   <a href="{$mall.storeurl}">{$mall.name}</a>
    <a href="{$mall.wechaturl}" class="fr">关注</a>
</div>-->
<div class="detail-slider-container swiper-container" style="margin-top: 0px;position:relative">
	<ul class="pro-list swiper-wrapper" id="detail-slider" >
		<if condition="$videoUrl neq ''">
			<li class="swiper-slide" data-type="video" style="background:black;">
				<video src="{$videoUrl}" controls poster="{$videoImgUrl}" playsinline x5-playsinline="" playsinline="" webkit-playsinline=""></video>
				<div class="video-img"><img src="{$videoImgUrl}?x-oss-process=image/resize,m_fill,h_640,w_640" style="width:100%"/></div>
			</li>
		</if>
		<volist name="picUrl1" id="picItem">
			<if condition="$i neq '1'">
				<li data-type="img" class="swiper-slide">
					<img class="default" src="{$picItem:picUrl}?x-oss-process=image/resize,w_640,h_640,m_mfit,x-oss-process=image/crop,w_640,h_640,g_nw">
				</li>
			</if>
		</volist>
	</ul>
	<p class="swiper-pagination"></p>
	<if condition="$videoUrl neq ''">
		<div class="slider_type">
			<span class="curr video">视频</span>
			<span class="img">图片</span>
		</div>
	</if>
	<if condition = "$inventory eq '1' AND $inventoryCount elt '0'">
		<div class="soldOut"></div>
		<elseif condition="$playType eq '4' and $seckillIsEnd neq '1' and $seckillIsStart eq '1' and $seckillInventoryCount elt 0"/>
		<div class="soldOut"></div>
	</if>
</div>
<script type="text/javascript">
//	mi.PRODUCT_DETAIL._initSlide();
	var mySwiper = new Swiper('.swiper-container',{
		pagination: {
			el: '.swiper-pagination',
		},
		autoplay:false,
		on: {
			slideChangeTransitionStart: function(){
				var to = this.activeIndex;
				var type = $(".swiper-slide:eq("+to+")").data("type");
				if(type=='img'){
					$(".slider_type .img").addClass("curr").siblings(".curr").removeClass("curr");
				}else{
					$(".slider_type .video").addClass("curr").siblings(".curr").removeClass("curr");
				}
			}
		}
	});
	if($("#detail-slider li").size()<=1){
		$(".swiper-pagination").hide();
	}
	$(".slider_type .video").click(function(){
		mySwiper.slideTo(0);
		$(this).addClass("curr").siblings(".curr").removeClass("curr");
	})
	$(".slider_type .img").click(function(){
		mySwiper.slideTo(1);
		$(this).addClass("curr").siblings(".curr").removeClass("curr");
	})
	$(".video-img").click(function(){
		$('#detail-slider video').get(0).play();
	})
	$('#detail-slider video').bind('pause',function(){
		$(this).hide();
		$(".video-img").show();
	})
	$('#detail-slider video').bind('play',function(){
		$(this).show();
		$(".video-img").hide();
	})
</script>
<if condition="$playType eq '4'">
	<div class="seckillStarted" <php>if($seckillIsStart!='1'|| $seckillIsEnd=='1'){</php>style="display:none" <php>}</php>>
		<div class="seckill">
			<div class="left fillColor">
				<if condition="$supportSpecification eq '1'">
					<php>if($minSeckillPrice!=$maxSeckillPrice){</php>
					<span class="seck-bpri">￥<b>{$minSeckillPrice|floatval}~{$maxSeckillPrice|floatval}</b></span>
					<span class="seck-spri"><i style="text-decoration: line-through;">￥{$maxFixedPrice|floatval}</i></span>
					<php>}else{</php>
					<span class="seck-bpri">￥<b>{$minSeckillPrice|floatval}</b></span>
					<span class="seck-spri"><i style="text-decoration: line-through;">{$maxFixedPrice|floatval}</i></span>
					<php>}</php>
					<else/>
					<span class="seck-bpri">￥<b>{$seckillPrice}</b></span>
					<span class="seck-spri"><i style="text-decoration: line-through;">￥{$fixedPrice} </i></span>
				</if>
			</div>
			<div class="right">
				<span class="secktimer">
				<if condition="$seckillIsEnd eq '1'">
					<p>已抢完</p>
					<elseif condition="$seckillIsStart eq '1'"/>
					<p style="display:inline;color: white;" class="lxftime" nowtime="{$nowTime}" endtime="{$seckillEndTime}" col="0" lxfday="no" lxftext="距秒杀结束时间"></p>
					<else />
					<p style="display:inline;color: white;" class="lxftime" nowtime="{$nowTime}" endtime="{$seckillStartTime}" starttime="{$seckillEndTime}" col="0" lxfday="no" lxftext="距秒杀开始："></p>
				</if>
			</span>
			</div>
		</div>
		<if condition="$quanInfo neq '' and $isMiUserCut gt 0 and $isShowLish eq '1'">
			<div class="pro-box">
				<div class="price" style="width:100%;overflow: hidden;margin-top: 0;font-size:12px;color:#333">
					<span style="color: #fff; background: #f85395; padding: 0px; margin: 0 2px 0 10px; font-size: 10px;">返</span><span style="color: {$mallHue.fontColor||default='#F65492'}; font-size: 10px;">{$isMiUserCut}元</span>
				</div>
			</div>
		</if>
	</div>
	<div class="seckillEnd" <php>if($seckillIsStart=='1'&& $seckillIsEnd!='1'){</php>style="display:none" <php>}</php>>
		<div class="seckill">
			<if condition="$quanInfo neq '' and $isMiUserCut gt 0 and $isShowLish eq '1'">
				<div class="left">
				<else/>
				<div class="left"  style="line-height:40px">
			</if>
				<if condition="$supportSpecification eq '1'">
					<php>if($minDisPrice>0&&$minDisPrice!=$maxDisPrice){</php>
					<span class="seck-bpri"><b>￥{$minDisPrice|floatval}~{$maxDisPrice|floatval}</b></span>
					<php>}else if($minDisPrice>0){</php>
					<span class="seck-bpri"><b>￥{$minDisPrice|floatval}</b></span>
					<php>}else if($minFixedPrice!=$maxFixedPrice){</php>
					<span class="seck-bpri"><b>￥{$minFixedPrice|floatval}~{$maxFixedPrice|floatval}</b></span>
					<php>}else{</php>
					<span class="seck-bpri"><b>￥{$minFixedPrice|floatval}</b></span>
					<php>}</php>
					<else/>
					<notempty name="discountedPrice">
						<span class="seck-bpri"><b>￥{$discountedPrice}</b></span>
					</notempty>
					<empty name="discountedPrice">
						<span class="seck-bpri">￥<b>{$fixedPrice}</b></span>
					</empty>
				</if>
				<if condition="$quanInfo neq '' and $isMiUserCut gt 0 and $isShowLish eq '1'">
					<span>
						<span style="color: #fff; background: #f85395; padding: 0px; margin: 0 2px 0 10px; font-size: 10px;">返</span>
						<span style="color: {$mallHue.fontColor||default='#F65492'}">{$isMiUserCut}元</span>
					</span>
				</if>
			</div>
			<div class="right" <php>if($seckillIsEnd=='1'){</php>style="display:none" <php>}</php>>
				<span class="secktimer">
					<if condition="$seckillIsEnd eq '1'">
						<p>已抢完</p>
						<elseif condition="$seckillIsStart eq '1'"/>
						<p style="display:inline;color: white;" class="lxftime" nowtime="{$nowTime}" endtime="{$seckillEndTime}" col="0" lxfday="no" lxftext="距秒杀结束时间"></p>
						<else />
						<p style="display:inline;color: white;" class="lxftime" nowtime="{$nowTime}" endtime="{$seckillStartTime}" starttime="{$seckillEndTime}" col="0" lxfday="no" lxftext="距秒杀开始："></p>
					</if>
					<if condition="$supportSpecification eq '1'">
						<php>if($minSeckillPrice!=$maxSeckillPrice){</php>
							<span class="seck-bpri">秒杀价：￥<b style="font-size:13px">{$minSeckillPrice|floatval}~{$maxSeckillPrice|floatval}</b></span>
						<php>}else{</php>
							<span class="seck-bpri">秒杀价：￥<b style="font-size:13px">{$minSeckillPrice|floatval}</b></span>
						<php>}</php>
					<else/>
						<span class="seck-bpri">秒杀价：￥<b style="font-size:13px">{$seckillPrice}</b></span>
					</if>
				</span>
			</div>
		</div>
	</div>
	<script>
		lxfEndtime();
	</script>
</if>
	<php>if($playType != '4'){</php>
		<div class="pro-box">
			<div class="price" style="overflow: hidden;">
				<if condition="$freeBuy eq '1'">
						<style>
							.price{
								height: 26px;
							}
						</style>
						<div style="float: left;">
							￥{$freeBuyMoney[0]}~￥<php>echo end($freeBuyMoney);</php>
						</div>
					<elseif condition="$teambuy eq '1'"/>
						<div style="float: left;">
							￥{$teamPrice|floatval}<del>￥{$fixedPrice|floatval}</del>
						</div>
						<span class="priceTag">{$teamCount}人团</span><br/>
					<elseif condition="$playType eq '5' AND $isEnjoyMiPrice eq '1'"/>
						<if condition="$supportSpecification eq '1' and $minMiPrice neq $maxMiPrice">
						好友价：￥{$minMiPrice|floatval}~{$maxMiPrice|floatval}<del>￥{$maxFixedPrice|floatval}</del>
						<elseif condition="$supportSpecification eq '1'"/>
						好友价：￥{$minMiPrice|floatval}<del>￥{$maxFixedPrice|floatval}</del>
						<else/>
						好友价：￥{$miPrice|floatval}<del>￥{$fixedPrice|floatval}</del>
					</if>
					<elseif condition="$supportSpecification eq '1'"/>
						<if condition="$minDisPrice gt 0 and $minDisPrice neq $maxDisPrice">
								￥{$minDisPrice|floatval}~{$maxDisPrice|floatval}<del>￥{$maxFixedPrice|floatval}</del>
							<elseif condition="$minDisPrice gt 0"/>
								￥{$minDisPrice|floatval}<del>￥{$maxFixedPrice|floatval}</del>
							<elseif condition="$minFixedPrice neq $maxFixedPrice"/>
								￥{$minFixedPrice|floatval}~{$maxFixedPrice|floatval}
							<else/>
								￥{$minFixedPrice|floatval}
						</if>
					<else/>
						<if condition="$discountedPrice neq ''">
							￥{$discountedPrice|floatval}<del>￥{$fixedPrice|floatval}</del>
							<else/>
							￥{$fixedPrice|floatval}
						</if>
				</if>
				<if condition="$quanInfo neq '' and $isMiUserCut gt 0 and $isShowLish eq '1'">
					<span style="color: #fff; background: #f85395; padding: 0px; margin: 0 2px 0 10px; font-size: 10px;">返</span><span style="color: {$mallHue.fontColor||default='#F65492'}; font-size: 10px;">{$isMiUserCut}元</span>
				</if>
			</div>
			
		</div>
	<php>}</php>
	<div class="pro-box" style="margin:10px 0">
	<if condition="$quanInfo neq ''">
		<dl class="pro-name">
			<dt style="display: -webkit-box;-webkit-box-pack: justify;">
			<if condition="$isShowPoster eq 0">
				<h1 style="font-size: 16px;word-break: break-all;width: 100%;height:auto">{$name}</h1>
			<else/>
				<h1 style="font-size: 16px;word-break: break-all;width: -webkit-calc(100% - 50px);height:auto">{$name}</h1>
				<div style="position: relative;width: 45px;text-align: center;color: {$mallHue.proDetailMainColor||default='#f75493'};font-size:12px;" id="share">
					<div style="position: absolute;left: 0;border-left: 1px solid #ccc;height: 25px;top: 5px;"></div>
					<i class="iconfont" style="display: block;text-align: center;font-size: 20px !important;position: relative;margin-top:2px;">&#xe615;</i>
					海报码
				</div>
			</if>
			</dt>
		</dl>
		<else/>
		<dl class="pro-name">
			<dt>
			<h1 style="font-size: 16px;height:auto">
				{$name}
			</h1>
			</dt>
		</dl>
	</if>
	</div>

	<if condition="$recommend neq ''">
		<div class="pro-box">
			<dl class="pro-name pro-recom" style="margin-top:0">
				<dt class="specialColor">{$recommend}</dt>
			</dl>
		</div>
	</if>
	<notempty name="priceTag">
		<div class="pro-box">
			<div class="pro-esp" <if condition="$recommend eq ''">style="margin-top:10px;"</if>>
			<volist name="priceTag" id="pct">
				<span><i class="iconfont">&#xe604;</i>{$pct}</span>
			</volist>
			</div>
		</div>
	</notempty>
<if condition="$description neq ''">
	<div class="p-comment" style="padding: 10px;font-size: 14px;color: #666;margin-top:10px">
		{$description}
	</div>
</if>
<if condition="$microId neq '' and $mallShareTitle neq ''">
	<div class="p-comment" style="margin:10px 0;padding:10px;">
		<div style="overflow:hidden">
			<div style="width:57px;height:57px;text-align: center;float:left"><img src="{$mallShareLogo}" style="max-width:100%;max-height:100%"/></div>
			<div style="margin-left: 67px;">
				<div>{$mallShareTitle}</div>
				<div style="font-size:14px;color:#7E7D7D;">{$mallShareDesc}</div>
			</div>
		</div>
		<div style="margin-top: 10px;text-align: center;">
			<a style="color:{$mallHue.proDetailMainColor||default='#f75493'};padding:2px 20px;border:1px solid {$mallHue.proDetailMainColor||default='#f75493'};border-radius: 50px;line-height: 25px;" href="{$Think.config.SERVER_HOST}call.html?customerId={$customerId}&module=mall&method=getMall&params=%7B%22id%22:{$microId}%7D">进入专区&nbsp;></a></div>
	</div>
</if>
<div class="p-comment" style="margin-top: 10px;display:none" id="p-comment">
</div>

<if condition="$contactInfo neq ''">
	<div class="p-detail" style="display:block">
		<h2 class="title_box">图文详情</h2>
		{$webPageContent}
	</div>
	<div class="contact_container">
		<if condition="$contactInfo['fullName'] eq ''">
			<h2>本页由<span>{$contactInfo['nickName']}</span>分享推荐</h2>
			<else/>
			<h2>本页由<span>{$contactInfo['fullName']}</span>分享推荐</h2>
		</if>
		<div class="contact_card">
			<div>
				<img src="{$contactInfo['headImgUrl']}" />
				<if condition="$contactInfo['fullName'] eq ''">
					<span>{$contactInfo['nickName']}</span>
					<else/>
					<span>{$contactInfo['fullName']}</span>
				</if>
			</div>
			<ul class="contact">
				<if condition="$contactInfo['phone'] neq '' AND $contactInfo['phoneTitle'] neq ''">
					<li onclick="detail.clickCount(1, '{$contactInfo["phoneTitle"]}', {$contactInfo['phone']})">
						<a href="tel:{$contactInfo['phone']}">
							<i class="iconfont phone">&#xe659;</i>
							<span>{$contactInfo['phoneTitle']}</span>
						</a>
					</li>
				</if>
				<if condition="$contactInfo['qrcode'] neq '' AND $contactInfo['qrcodeTitle'] neq ''">
					<li onclick="detail.clickCount(2, '{$contactInfo["qrcodeTitle"]}', '{$contactInfo["qrcode"]}')">
						<a>
							<i class="iconfont qrcode">&#xe68a;</i>
							<span>{$contactInfo['qrcodeTitle']}</span>
						</a>
					</li>
				</if>
				<if condition="$contactInfo['contactTel'] neq '' AND $contactInfo['contactTitle'] neq ''">
					<li onclick="detail.clickCount(3, '{$contactInfo["contactTitle"]}', '{$contactInfo["contactTel"]}')">
						<a href="tel:{$contactInfo['contactTel']}">
							<i class="iconfont contact">&#xe709;</i>
							<span>{$contactInfo['contactTitle']}</span>
						</a>
					</li>
				</if>
			</ul>
		</div>
	</div>
	<else/>
	<div class="p-detail" style="display:block;padding-bottom:50px">
		<h2 class="title_box">图文详情</h2>
		{$webPageContent}
	</div>
</if>
<div class="mark" style=""></div>
<div class="qrcodeShow">
	<a class="close" onclick="$('.mark').hide();$('.qrcodeShow').hide();"></a>
	<div class="card">
		<span>长按二维码找到Ta</span>
		<img src="{$contactInfo['qrcode']}" />
	</div>
</div>
<div class="tool-box">
	<dl>
		<if condition="$teambuy eq '1'">
			<dt>
				<!--<a id="car" class="car" onclick="detail.goCart('{$vId}')" >
                       <div class="num" id="carNum"></div>
                   </a>-->
				<a href="{$mall.storeurl}" class="left-btn">
					<i class="iconfont">&#xe605;</i>
					<p>首页</p>
				</a>
				<if condition="$favorite eq '1'">
					<a id="favorite" class="left-btn fav1" favorite="{$favorite}">
						<i class="iconfont">&#xe607;</i>
						<p>心愿</p>
					</a>
					<else/>
					<a id="favorite" class="left-btn" favorite="{$favorite}">
						<i class="iconfont">&#xe606;</i>
						<p>心愿</p>
					</a>
				</if>
			</dt>
			<dd>
				<a class="buy iteamBtn <if condition='$isStart neq 1 OR $isEnd eq 1'>btn-disabled</if>" id="buy-now" data-type="now"><span>直接购买</span> <br />
					<notempty name="discountedPrice">
						<span>{$discountedPrice}/件</span>
					</notempty>
					<empty name="discountedPrice">
						<span>{$fixedPrice}/件</span>
					</empty>
				</a>
				<a class="add-car iteamBtn <if condition='$isStart neq 1 OR $isEnd eq 1'>btn-disabled</if>" id="buy-team" data-type="team" style="background-color:{$mallHue.proDetailMainColor||default='#f75493'}"><span>组团买</span><br /><span>{$teamPrice}/件</span></a>

			</dd>
			<if condition='$isStart neq 1 OR $isEnd eq 1 or $hasList neq 1'>
				<else />
				<a class="btn-goteam" href="call.html?module=tuan&customerId={$customerId}&method=getTeamOrderList&params=%7B%22pid%22:{$id}%7D">即将成功的团</a>
			</if>
			<else/>
			<dt>
				<a href="{$mall.storeurl}" class="left-btn">
					<i class="iconfont">&#xe605;</i>
					<p>首页</p>
				</a>
				<if condition="$favorite eq '1'">
					<a id="favorite" class="left-btn fav1" favorite="{$favorite}">
						<i class="iconfont">&#xe607;</i>
						<p>心愿</p>
					</a>
					<else/>
					<a id="favorite" class="left-btn" favorite="{$favorite}">
						<i class="iconfont">&#xe606;</i>
						<p>心愿</p>
					</a>
				</if>
			</dt>
			<dd>
				<if condition="$inventory eq '1' AND $inventoryCount elt '0'">
					<a class="add-car btn-disabled">加入购物车</a>
					<a class="buy btn-disabled">立即购买</a>
					<elseif condition="$freeBuy eq '1' AND $virtual eq '1'"/>
					<style>
						.tool-box dd
						{
							margin-left: 160px;
						}
					</style>
					<!-- <a class="add-car btn-disabled" id="addCar">加入购物车</a>-->
					<a class="buy" onclick="detail.productShow(this,1);">立即购买</a>
					<elseif condition="$freeBuy eq '1'"/>
					<a class="add-car" id="addCar" onclick="detail.productShow(this,0);">加入购物车</a>
					<a class="buy" onclick="detail.productShow(this,1);">立即购买</a>
					<elseif condition="$playType eq '4' and $seckillIsStart eq '1' and $seckillIsEnd neq '1' and $seckillInventoryCount elt '0'"/>
					<a class="add-car btn-disabled">加入购物车</a>
					<a class="buy btn-disabled">立即购买</a>
					<elseif condition="$playType eq '4'"/>
					<a class="add-car" onclick="detail.productShow(this,0);" id="addCar">加入购物车</a>
					<a class="buy" onclick="detail.productShow(this,1);">立即购买</a>
					<elseif condition="$virtual eq '1'"/>
					<!--<a class="add-car btn-disabled" id="addCar">加入购物车</a>-->
					<style>
						.tool-box dd
						{
							margin-left: 160px;
						}
					</style>
					<a class="buy" onclick="detail.productShow(this,1);">立即购买</a>
					<elseif condition="$playType eq '5' AND $isEnjoyMiPrice eq '1'"/>
					<a class="add-car" id="addCar" onclick="detail.productShow(this,0);">加入购物车</a>
					<a class="buy" onclick="detail.productShow(this,1);">立即购买</a>
					<else/>
					<a class="add-car" id="addCar" onclick="detail.productShow(this,0);">加入购物车</a>
					<a class="buy" onclick="detail.productShow(this,1);">立即购买</a>
				</if>
			</dd>
		</if>
	</dl>
</div>

<div id="evaluationpid" style="display:none;">{$id}</div>
<div class="fav-mask" id="FavMask">
	<div class="msg">
		耶！收藏成功,87%的人点击关注，便于查看收藏的商品。
	</div>
</div>
<input type="hidden" id="shareImg" value="<php>echo $picUrl1[1]->picUrl;</php>">
<notempty name="footerTpl">
	<include file="$footerTpl"/>
</notempty>
<div class="playWarm">
	<div>
		<a onclick="hidePlayWarm()" class="closeWarm"></a>
		<div>
			<img src="{$Think.config.RESOURCEURL}wx_assets/tuan/img/warm.png"/>
		</div>
	</div>
</div>
<a id="car" class="car" onclick="detail.goCart('{$vId}')">
	<i class="iconfont">&#xe608;</i>
		<span>
			<p id="carNum"></p>
		</span>
</a>
<script type="text/html" id="prop-tpl">
	<dl>
		<dt><%=pName%></dt>
		<%for(var i=0;i<pList.length;i++){%>
		<%if(pUrl[i]){%>
		<dd data-name="<%=pList[i]%>" style="vertical-align: top;"><img src="<%=pUrl[i]%>"/><label><%=pList[i]%></label></dd>
		<%}else{%>
		<dd data-name="<%=pList[i]%>" style="vertical-align: top;"><label style="float:none"><%=pList[i]%></label></dd>
		<%}%>
		<%}%>
	</dl>
</script>
<if condition="$teambuy eq '1'">
	<script>
		if($(window).height()<500)
		{
			$('.playWarm').addClass('small')
		}
		function hidePlayWarm(){
			$('.playWarm').hide();
			setCookie('playFirst',1);
		}
		var isFirst=getCookie('playFirst');
		//第一次来,弹出提示
		if(isFirst==null)
		{
//		$('.playWarm').show();
		}
		else if(isFirst==1)
		{
			$('.playWarm').hide();
		}

	</script>
</if>
<script type="text/javascript" charset="utf-8">
	var previewImageUrls=[];
	var pImgs=$(".p-detail img");
	pImgs.each(function(){
		var url=$(this).attr("src") || $(this).attr("original");
		previewImageUrls.push(url);
	});
	//图片预览
	pImgs.click(function(){
		var url=$(this).attr("src") || $(this).attr("original");
		var par=$(this).parent();
		if(par && par.length>0 && par[0].tagName.toUpperCase()!=="A"){
			wx.previewImage({
				current: url,
				urls: previewImageUrls
			});
		}
	})
</script>
<!--<script type="text/html" id="commentTpl">
    <%if(list && list.length){
    for(var i=0;i<list.length;i++){
    var item = list[i];
    var imgs = list[i].imgurl;
     item.RESOURCEURL="{$Think.config.RESOURCEURL}";
    %>
    <div class="main">
        <div class="info">
			<%if(item.headImgUrl) {%>
    			<span class="head"><img src="<%=item.headImgUrl%>"></span>
                <span class="name"><%=item.nickName%></span>
            <%} else {%>
                <span class="head"><img src="<%=item.RESOURCEURL%>wx_assets/images/defaultHeadImg.png"></span>
                <span class="name">匿名用户</span>
            <%}%>
            <span class="time"><%=item.createTime%></span>
        </div>
        <div class="commen"><%=item.comment%></div>
        <%if(imgs && imgs.length){%>
            <div class="comnt-img">
                   <% for (var y=0;y<imgs.length;y++) {%>
                    <div>
                        <img src="<%=imgs[y]%>@320h_320w_1e_1c"/>
                    </div>
                    <%}%>
            </div>
        <%}%>
        <%if(item.sizeName) {%>
            <div class="spec">规格：<%=item.sizeName%>&nbsp;&nbsp;<%=item.colorName%></div>
        <%}%>
    </div>
    <%}}else{%>
    <div class='no-comment'>来晒单嘛！有了你，我就不再孤独！</div>
    <%}%>
</script>-->
<script type="text/html" id="commentTpl">
	<%if(list && list.length){%>
	<h2 class="title_box">大家怎么说</h2>
	<%for(var i=0;i<list.length;i++){
	var item = list[i];
	var imgs = list[i].imgurl;
	item.RESOURCEURL="{$Think.config.RESOURCEURL}";
	%>
	<div class="main">
		<div class="info">
			<%if(item.headImgUrl) {%>
			<span class="head"><img src="<%=item.headImgUrl%>"></span>
			<span class="name"><%=item.nickName%></span>
			<%} else {%>
			<span class="head"><img src="<%=item.RESOURCEURL%>wx_assets/images/defaultHeadImg.png"></span>
			<span class="name">匿名用户</span>
			<%}%>
			<span class="time"><%=item.createTime%></span>
		</div>
		<div class="commen"><%=item.comment%></div>
		<%if(imgs && imgs.length){%>
		<div class="comnt-img">
			<% for (var y=0;y<imgs.length;y++) {%>
			<div>
				<img src="<%=imgs[y]%>@320h_320w_1e_1c"/>
			</div>
			<%}%>
		</div>
		<%}%>
		<%if(item.sizeName) {%>
		<div class="spec">规格：<%=item.sizeName%>&nbsp;&nbsp;<%=item.colorName%></div>
		<%}%>
	</div>
	<%}%>
	<a href="call.html?userName=&customerId={$customerId}&module=product&method=getcommentList&params=%7B%22pid%22:{$id}%7D" class="getmore">查看更多口碑</a>
	<%}%>

</script>
<style>
	.mask{
		position: fixed;
		background-color: rgba(0,0,0,.8);
		height: 100%;
		z-index: 999;
		width: 100%;
		color: white;
		top:0;
		display:none;
	}
	.mask img{
		position: absolute;
		right: 20px;
		top: 0;
		width: 100px;
		height: 100px;
	}
	.mask span{
		display: block;
		width: 305px;
		margin: 20px auto 0;
		line-height: 23px;
	}
</style>
<div class="mask">
	<img src="{$Think.config.RESOURCEURL}wx_assets/images/product/fav-arrow.png{$Think.config.RESOURCE_VER}"/>
	<span style="margin-top:158px;">点击右上角“分享”按钮<br/>选择“发送给朋友”或者“分享到朋友圈”<br/>或者“复制链接”后发送链接给朋友</span>
	<span>{$recommend}</span>
	<span>长按选中后复制推荐理由。</span>
</div>
<div class="productInfo" id="productInfo" style="z-index:100;">
	<div class="main">
		<div class="info">
			<div class="closeDiv"><div class="close" id="close"></div></div>
			<div class="imgDiv" align="center">
				<volist name="picUrl1" id="picItem">
					<if condition="$i eq '2'">
						<img class="default" src="{$picItem:picUrl}">
					</if>
				</volist>
			</div>
			<div class="p-name">
				<div class="title">
					<if condition="$freeBuy eq '1'">
						<span>由你定价</span>&nbsp;
					</if>
					{$name}
				</div>
				<div class="price" style="overflow: hidden;height: 26px;">
					<if condition="$freeBuy eq '1'">
						￥{$freeBuyMoney[0]}~￥<php>echo end($freeBuyMoney);</php>
						<elseif condition="$supportSpecification eq '1'"/>
						<div style="float: left;" id="buyPrice">
							<if condition="$playType eq '5' AND $isEnjoyMiPrice eq '1' and $minMiPrice neq $maxMiPrice">
								好友价：￥{$minMiPrice|floatval}~{$maxMiPrice|floatval}
								<elseif condition="$playType eq '5' AND $isEnjoyMiPrice eq '1'"/>
								好友价：￥{$minMiPrice|floatval}
								<elseif condition="$playType eq '4' AND $seckillIsStart eq '1' AND $seckillIsEnd neq '1' AND $minSeckillPrice neq $maxSeckillPrice"/>
								￥{$minSeckillPrice|floatval}~{$maxSeckillPrice|floatval}
								<elseif condition="$playType eq '4' AND $seckillIsStart eq '1' AND $seckillIsEnd neq '1'"/>
								￥{$minSeckillPrice|floatval}
								<elseif condition="$minDisPrice gt 0 and $minDisPrice neq $maxDisPrice"/>
								￥{$minDisPrice|floatval}~{$maxDisPrice|floatval}
								<elseif condition="$minDisPrice gt 0"/>
								￥{$minDisPrice|floatval}
								<elseif condition="$minFixedPrice neq $maxFixedPrice"/>
								￥{$minFixedPrice|floatval}~{$maxFixedPrice|floatval}
								<else/>
								￥{$minFixedPrice|floatval}
							</if>
						</div>
						<else/>
						<div style="float: left;" id="buyPrice">
							<if condition="$playType eq '5' AND $isEnjoyMiPrice eq '1'">
								好友价：￥{$miPrice|floatval}
								<elseif condition="$playType eq '4' AND $seckillIsStart eq '1' AND $seckillIsEnd neq '1'"/>
								￥{$seckillPrice|floatval}
								<elseif condition="$discountedPrice neq ''"/>
								￥{$discountedPrice|floatval}
								<else/>
								￥{$fixedPrice|floatval}
							</if>
						</div>
						<!--<div>
							<volist name="priceTag" id="pct">
			            		<span class="priceTag">{$pct}</span>
			            	</volist>
			            </div>-->
					</if>

				</div>
			</div>
		</div>
		<if condition="$customized neq ''">
			<div style="overflow-y: auto;max-height: 50vh;-webkit-overflow-scrolling: touch;">
			<else/>
			<div style="max-height:250px;">
		</if>
		<if condition="$supportSpecification eq '1'">
			<div class="mod_property" id="prop-list"></div>
		</if>
		<if condition="$freeBuy eq '1'">
			<div class="mod_property" id="free-list">
				<dl>
					<dt>请选择价格</dt>
					<volist name="freeBuyMoney" id="money">
						<dd data-value="{$money}"><label style="float:none">{$money}</label></dd>
					</volist>
					<dt id="invitation" style="display:none;margin-bottom:0;"></dt>
				</dl>
			</div>
		</if>

			<div class="buyNum">
				<div class="title">购买数量</div>
				<div class="numDiv">
					<a class="sub disabled" tag="sub" id="sub"></a>
					<input type="number" min="1" max="10000" step="1" value="1" class="num" id="buyNum" oninput="detail.checkNum()" onblur="detail.blurCheckNum()" />
					<if condition="$inventory eq '1' AND $supportSpecification eq '0' AND $inventoryCount lt 2">
						<a class="plus disabled" tag="add" id="plus1"></a>
						<else/>
						<a class="plus" tag="add" id="plus"></a>
					</if>

				</div>
				<notempty name="inventory">
					<if condition="$playType eq '4' AND $seckillIsStart eq '1' AND $seckillIsEnd neq '1'">
						<if condition="$supportSpecification eq '0' AND $inventoryCount gt 0">
							<span class="inventory" id="inventory_count" style='display:block'>&nbsp;剩余<span id="stock-num">{$seckillInventoryCount}</span>件</span>
							<else/>
							<span class="inventory" id="inventory_count" style="display:none">&nbsp;剩余<span id="stock-num">{$seckillInventoryCount}</span>件</span>
						</if>
						<else/>
						<if condition="$supportSpecification eq '0' AND $inventoryCount gt 0">
							<span class="inventory" id="inventory_count" style='display:block'>&nbsp;剩余<span id="stock-num">{$inventoryCount}</span>件</span>
							<else/>
							<span class="inventory" id="inventory_count" style="display:none">&nbsp;剩余<span id="stock-num">{$inventoryCount}</span>件</span>
						</if>
					</if>
					<!--stockCount-->
				</notempty>
			</div>
		<if condition="$customized neq ''">
			<style>
				select {
					padding: 0;
					width: 70px;
					margin-right: 6px;
					opacity: 0;
					height: 44px;
				}
			</style>
			<ul class="" id="customized">
				<volist name="customized" id="cus">
					<li style="line-height:30px;">
						<div class="customizedName" style="margin:10px 10px 10px 0;display:none">{$cus.name}</div>
						<if condition="$cus.type eq '2'">
							<div style="margin: 10px 0;position:relative">
								<i class="icon-xuanze1 cus_icon"></i><input class="customizedDescription" type="text" placeholder="{$cus.name}">
								<select class="customizedClass customizedData" data-type="{$cus.type}"  style="opacity: 0;position:absolute;top:0;left:0">
									<option>{$cus.name}</option>
									<volist name="cus.description" id="des">
										<option value="{$des}">{$des}</option>
									</volist>
								</select>
							</div>
							<elseif condition="$cus.type eq '1'"/>
							<div style="margin: 10px 0;position:relative">
								<i class="cus_icon icon-riqi2"></i>
								<input class="customizedDescription" type="text" placeholder="{$cus.description}">
								<input class="customizedClass customizedData" type="date" data-type="{$cus.type}" style="opacity: 0;position:absolute;top:0;left:0"/>
							</div>
							<elseif condition="$cus.type eq '6'"/>
							<div style="margin: 10px 0;position:relative">
								<i class="cus_icon icon-dizhi"></i>
								<div class="customizedClass" id='m_cityed'>
									<div class="cityselect province"><input placeholder="选择省份"/><i class="down icon-arrowright"></i></div><select name="province" class="p"></select>
									<div class="cityselect city"><input placeholder="选择城市"/><i class="down icon-arrowright"></i></div><select name="city" class="c"></select>
									<div class="cityselect area"><input placeholder="选择"/><i class="down icon-arrowright"></i></div><select name="area" class="a"></select>
								</div>
							</div>
							<input type="hidden" class="customizedDescription" data-type="{$cus.type}">
							<elseif condition="$cus.type eq '7'"/>
								<div style="margin: 10px 0;position:relative">
									<i class="cus_icon icon-shijian-copy"></i>
									<input class="customizedDescription" type="text" placeholder="{$cus.description}">
									<input class="customizedClass customizedData" type="time" data-type="{$cus.type}" style="opacity: 0;position:absolute;top:0;left:0"/>
								</div>
							<elseif condition="$cus.type eq '3'"/>
								<div style="margin: 10px 0;position:relative">
									<i class="cus_icon icon-ren"></i>
									<input class="customizedDescription" type="text" placeholder="{$cus.description}" data-type="{$cus.type}"/>
								</div>
							<elseif condition="$cus.type eq '4'"/>
								<div style="margin: 10px 0;position:relative">
									<i class="cus_icon icon-shouji"></i>
									<input class="customizedDescription" type="tel" placeholder="{$cus.description}" data-type="{$cus.type}"/>
								</div>
							<elseif condition="$cus.type eq '5'"/>
								<div style="margin: 10px 0;position:relative">
									<i class="cus_icon icon-youxiang"></i>
									<input class="customizedDescription" type="text" placeholder="{$cus.description}" data-type="{$cus.type}"/>
								</div>
							<else/>
							<div style="margin: 10px 0;position:relative">
								<i class="cus_icon icon-neirong"></i>
								<input class="customizedDescription" type="text" placeholder="{$cus.description}" data-type="{$cus.type}"/>
							</div>
						</if>
					</li>
				</volist>

			</ul>
		</if>
		</div>
	</div>
	<if condition="$inventory neq '' AND $supportSpecification eq '0' AND $inventoryCount eq ''">
		<div class="beSure btn_disabled">确定</div>
		<else/>
		<div class="beSure">确定</div>
	</if>

</div>
<script type="text/javascript">
	var pid = {$id};
	var favoriteCount = {$favoriteCount};
	var availSku = '{$availSku}';
	availSku = encodeURIComponent(availSku);
	var sku = new Array();
	var orderType, availSku, cku, totalStock, bookEndTime, bookBeginTime, isNew, wxInfo;
	var size = {$size};
	if (size != null) {
		var sizeUnit = "{$sizeUnit}";
		var sizeUrl = JSON.parse('{$sizeurl}');
		sku.push({"pList": size, "pName":sizeUnit,"pUrl":sizeUrl,"availSku":availSku});
	}
	var color = {$color};
	if (color != null) {
		var colorUnit = "{$colorUnit}";
		var colorUrl = JSON.parse('{$colorurl}');
		sku.push({"pList": color, "pName":colorUnit,"pUrl":colorUrl,"availSku":availSku});
	}
	if (size == null && color == null) {
		sku = [];
		availSku = [];
	} else {
		availSku = {$availSku} == null ? [] : {$availSku};
		$('#inventory_count').hide();
	}
	var inventory = {$inventory};
	var totalInventoryCount = {$inventoryCount};
	var freeBuy = "{$freeBuy}";
	var freeBuyMoney = "{$freeBuyMoney}";
	var price = "{$discountedPrice}"||"{$fixedPrice}";
	$("#free-list").css("bottom",-$("#free-list").height()+"px");
	var orderType = '{$fixedPrice}' === '' ? 'point' : 'buy';
	if (orderType === 'point') {
		var isMember = parseInt('{$isMember}');
		var isCheck = parseInt('{$isCheck}');
		var points = parseInt('{$points}');
		var myScore = parseInt('{$myScore}');
	}
	var isNew = "false";
	var wxInfo = { "isFocus": "true", "wxId": "ONLY_BESTSELLER" };
	var shareData = {
			visitId: "{$visitId}",
			lastShareUId: '{$lastShareUId}'
	}
</script>
<script type="text/javascript">
	var baseUrl = '{$Think.config.SERVER_HOST}';
	var hrefPath = baseUrl+'call.html?customerId={$customerId}';
	var basePath = baseUrl+'call.json?customerId={$customerId}&userName={$userName}';
	var p=$.util.getParamAsObject();
	var isTeamPro="{$teambuy}";
	var distributionId = "{$distributionId}";
	var teamBuyType = '';
	var playType = "{$playType}";
	var seckillIsStart = "{$seckillIsStart}";
	var seckillIsEnd = "{$seckillIsEnd}";
	var teamId=p.teamId || "";
	var buyParams={
		"pids": "{$id}",
		"type": "buy",
		"qId":p.qId||"{$quanInfo.qId}",
		"miUId":p.miUId||"{$quanInfo.uId}",
		"vId":"{$vId}",
		"shareId":"{$sId}",
		"shareFromGuid":p.fromGuid,
		"userName":'{$userName}',
		"visitId":"{$visitId}",
		"distributionId":distributionId,
		"proSource":'{$proSource}'
	};
	var detail={
		pageSize:3,
		page:0,
		cartList:null,//购物车详情
		guid:"{$guid}",
		init:function(){
			this._initProp();
			this._initEvent();
			this._initTab();
			this.initCity();
		},
		initCity:function(){
			$('#m_cityed').citys({required:false});
		},
		// 统计点击次数
		clickCount: function (type, title, content) {
			if (type == 2) {
				$('.mark').show();
				$('.qrcodeShow').show();
			}
			var data = {
				qid: '{$qId}', //密友圈id                
				miUid: '{$miUId}',  //miUid
				module: 'micontent',  //如果是文章,值为micontent
				moduleId: '{$mId}',  //文章id
				type: type,  //1:个人电话2:我的海报3:通用联系            //如果点击的是phoneTitle就是1
				title: title, //type对应的标题        phoneTitle/qrcodeTitle/contactTitle这三者的标题
				content: content //type对应的内容        phoneTitle对应的内容
			}
			$.ajax({
				type: 'get',
                url: '{$Think.config.SERVER_HOST}call.json?customerId={$customerId}',
                dataType: 'json',
                data: {
                   module: "community",
                   method: "saveClickContact",
                   params: JSON.stringify(data)
                },
				success (res) {
					console.log(res)
				}
			})
		},
		_initProp: function(){
			var size = {$size};
			var color= {$color};
			var freebuy = '{$freeBuy}';
			var sku;
			if(size){
				var sizeUnit = '{$sizeUnit}';
				var sizeUrl = JSON.parse('{$sizeurl}');
				sku = {"pList": size,"pUrl":sizeUrl,"pName":sizeUnit};
				var html=template("prop-tpl", sku),
						container=$("#prop-list");
				container.append(html);
			}
			if(color){
				var colorUnit = '{$colorUnit}';
				var colorUrl = JSON.parse('{$colorurl}');
				sku={"pList": color,"pUrl":colorUrl,"pName":colorUnit};
				var html=template("prop-tpl", sku),
						container=$("#prop-list");
				container.append(html);
			}
			$("#productInfo").css("bottom",($("#productInfo").height()+50)*-1).width($(window).width());
		},
		/*团购相关扩展*/
		tuan:{
			createTeamOrder: function(oid,callback) {
				var p=$.util.getParamAsObject();
				p.pid="{$id}";
				p.oid=oid;
				$.req.get("call.json?customerId={$customerId}&module=tuan&method=createTeamOrder",{
					userName:"{$userName}",
					params:p
				},function(data){
					if(!data.code){
						callback && callback(data);
					} else {
						$.util.alert(data.msg);
					}
				});
			}
		},
		_initTab: function() {
			var me = this;
			$.util.pageLoading.show();
			me._loadList(me.page,function(){
				$.util.pageLoading.hide();
			});
			$("#prop-list dl").each(function(){
				var dt = $(this).find("dt");
				var dd = $(this).find("dd");
				var width = parseInt(dt.css("width"));
			});

		},

		/***禁止滑动***/
		stop:function(){
			$('html').addClass('noscroll');
		},
		/***取消滑动限制***/
		move:function(){
			$('html').removeClass('noscroll');
		},
		_initEvent:function(){
			var me=this;
			$.util.initDataLoading({
				me:detail,
				lastChildren:function(){
					return '';
				},
				page:function(){
					return detail.page;
				},
				pageCount:function(){
					return detail.pageCount;
				}
			});
//			productInfo
//			$('#productInfo').on('touchmove', function(event) {
//				event.preventDefault();
//				event.stopPropagation();
//			});
			$(".customizedData").change(function(){
				$(this).prev().val($(this).val());
			})
			$("#close").click(function(){
				var scroll = $("html").css("margin-top");
				$("#productInfo").css("bottom",($("#productInfo").height()+50-parseInt(scroll))*-1);
				setTimeout(function(){
					$("#productInfo").removeClass("show");
					me.move();
					$("#opacity").hide();$(".mark").hide();
					$("html").css("margin-top",null);
					$(window).scrollTop(-parseInt(scroll));
				},500)
			});
			$(".sub,.plus").on("click", function(e) {
				me._initBuyNum(e);
			});
			$("#prop-list dd").on("click", function(e) {
				me.statisticSelected(this);
			});
			$("#free-list dd").on("click",function(){
				$("#invitation").show();
				$(this).addClass("current").siblings().removeClass("current");
				me.countPerNum();
			});
			$("#buy-team,#buy-now").click(function(){
				window.teamBuyType = $(this).data("type");
				if($(this).data("type")=='team'){
					$("#buyPrice").html('{$teamPrice}');
				}else{
					var price = '{$discountedPrice}'||'{$fixedPrice}';
					$("#buyPrice").html(price);
				}
				detail.productShow(this,1);
			});
			$(".beSure").click(function(){
				if($(this).hasClass("btn_disabled")){return}
				if(!me.status){
					var addCar = document.getElementById("addCar");
					me.addToCart(addCar);
					return;
				}
				if (window.freeBuy == "1") {
					$("#free-list").css({
						"bottom": 0,
						"visibility": "visible"
					});
				}
				me._initBuy($(this));
			});
			$("#favorite").click(function() {
				var me = $(this);
				var favorite = $(this).attr("favorite");
				var customerId = $.util.getParam("customerId");
				if (favorite == "1") {
					var method = "removeFavorite";
				} else {
					var method = "addFavorite";
				}
				$.util.pageLoading.show();
				$.req.get("call.json?customerId=" + customerId + "&module=product&method=" + method, {
					params: {
						"id": '{$id}'
					}
				}, function(data) {
					if (data && !data.code) {
						if (favorite == "1") {
							me.find("i").html("&#xe606;");
							me.attr("favorite", 0);
							me.removeClass('fav1');
						} else {
							me.find("i").html("&#xe607;");
							me.attr("favorite", 1);
							me.addClass('fav1');
						}
					}
					$.util.pageLoading.hide();
					// 登录失效跳到登录页
					if (+data.code === 15 || +data.code === 16) {
						$.util.alert(data.msg)
						setTimeout(function() {
							location.href = baseUrl+'call.html?customerId={$customerId}&module=personCenter&method=login&code=' + data.code + '&redirect_url=' + encodeURIComponent(location.href);
						}, 1000)
					}
				});
			});
			$("#share").click(function(){
				location.href = baseUrl+'call.html?customerId={$customerId}&module=community&method=getPromotionCode&params=%7B"qid"%3A{$quanInfo.qId}%2C"module"%3A"product"%2C"moduleId"%3A"{$id}"%2C"uId"%3A{$quanInfo.uId}%7D';
			});
		},
		statisticSelected: function(e) {
			var me=this;
			var b = $(e);
			if (!b.hasClass("current") && !b.hasClass("disabled")) {
				b.addClass("current").siblings().removeClass("current");
				$("#buyNum").val(1);
			}
			me._initCount();
		},
		_renderList:function(data,page,callback){
			var me=this;
			if(data){
				var html=template("commentTpl", data),
						container=$("#p-comment");
				container.append(html);
				if(data.count>0){
					container.show();
				}
				me.page=page;
				me.pageCount=data.pageCount;
				callback && callback();
				showImg();
			}
		},
		_loadList:function(page,callback){
			var me=this;

			$.req.get("call.json?module=product&customerId={$customerId}&method=getcommentList",{
				userName:"{$userName}",
				params:{
					"pid":"{$id}",
					"start":page,
					"limit":me.pageSize
				}
			},function(data){
				if(data){

					me._renderList(data,page,callback);
				}
			});

		},
		_initBuyNum: function(e) {
			var me=this;
			var buyNum = $("#buyNum"),
					target = $(e.target),
					type = target.attr("tag"),
					num = 1 * buyNum.val();
			if (target.hasClass("disabled")) {
				return;
			}
			if (num) {
				if (isNaN(num)) {
					buyNum.val(1);
				} else {
					var ktotal = $("#stock-num").html() || 999;
					if(!me.selectedSpec()){
						return;
					}
					if (type == "add") {
						buyNum.val(++num);
						me._initCount();
						$("#sub").removeClass("disabled");
						if(num>=ktotal){
							$("#plus").addClass("disabled");
						}
					} else {
						if (num > 1) {
							buyNum.val(--num);
							$("#plus").removeClass("disabled");
							if (num < 2) {
								$("#sub").addClass("disabled");
							}
						}
					}
				}
			}
			me.countPerNum();
		},
		countPerNum:function(){
			var price =  '{$discountedPrice}'||'{$fixedPrice}';
			var pNum = Math.ceil($.util.accSub(price,$("#free-list dd.current").data("value")));
			var num = $("#buyNum").val();
			pNum = num*pNum;
			if(pNum){
				$("#invitation").html("需要"+pNum+"个好友帮忙减价");
			}else{
				$("#invitation").html( "正常价格，可直接购买。");
			}
		},
		_initCount:function(){
			var availSku = JSON.parse('{$availSku}');
			var inventory = '{$inventory}';
			var inventoryCount = '{$inventoryCount}';
			var playType = '{$playType}';
			var isEnjoyMiPrice = '{$isEnjoyMiPrice}';
			if("{$supportSpecification}"==1) {
				if (availSku) {
					var size = {$size};
					var color = {$color};
					var key = '';
					if (size) {
						var sizeName = $("#prop-list dl:eq(0)").find("dd.current").data("name");
						key += sizeName;
					}
					if (color) {
						var colorName = $("#prop-list dl:eq(1)").find("dd.current").data("name");
						key += "|" + colorName;
					}
					if ((color && !colorName)||!availSku[key])return;
					var fixedPrice = parseFloat(availSku[key].fixedPrice);
					var discountedPrice = parseFloat(availSku[key].discountedPrice);
					var miPrice = parseFloat(availSku[key].miPrice);
					var stockCount = parseInt(availSku[key].inventoryCount);
					if (playType != 3 && '{$freeBuy}' != 1 && '{$teambuy}' != 1) {
						if (playType == 5 && isEnjoyMiPrice == 1) {
							$("#buyPrice").html("好友价：￥" + miPrice);
						} else if (discountedPrice > 0) {
							$("#buyPrice").html("￥" + discountedPrice);
						} else {
							$("#buyPrice").html("￥" + fixedPrice);
						}
					}
					if (parseInt(inventory)) {
						if (stockCount <= 0) {
							$(".soldOut").show();
							$(".beSure").addClass("btn_disabled");
						} else {
							$(".soldOut").hide();
							$(".beSure").removeClass("btn_disabled");
						}
						$("#inventory_count").show();
						$("#stock-num").html(stockCount);
						var nowNum = parseInt($("#buyNum").val());
						if (nowNum >= stockCount) {
							$("#plus").addClass("disabled");
						} else {
							$("#plus").removeClass("disabled");
						}
						if (nowNum < 2) {
							$("#sub").addClass("disabled");
						}
					}
				} else {
					if (parseInt(inventory)) {
						var nowNum = parseInt($("#buyNum").val());
						if (nowNum >= inventoryCount) {
							$("#plus").addClass("disabled");
						} else {
							$("#plus").removeClass("disabled");
						}
					}
				}
			}
		},
		selectedSpec:function(){
			var first=$("#prop-list dl").eq(0);
			var second=$("#prop-list dl").eq(1);
			var supportSpecification='{$supportSpecification}' || 0;
			if(parseInt(supportSpecification)) {
				if($("#prop-list dl").size()>0){
					if((first && !first.find(".current").size()) ){
						var name ="{$sizeUnit}";
						$.util.alert("请选择"+name+"!");
						return false;
					}
					if(second.length>0 && !second.find(".current").size()){
						var name ="{$colorUnit}";
						$.util.alert("请选择"+name+"!");
						return false;
					}
				}
			}
			var freeBuy = parseInt('{$freeBuy}');
			if( freeBuy&&!$("#free-list dd").hasClass("current")){$.util.alert("没有选择价格");return;}
			return true;
		},
		productShow:function(ctrl,status){
			var me= this;
			me.status = status;
			var scroll = $(window).scrollTop();
			$("html").css("margin-top","-"+scroll+"px");
			this.stop();
			if($(ctrl).hasClass("btn-disabled")){return;}
			$("#buyNum").val(1);
			$("#invitation").hide();
			$("#productInfo").css("bottom",-(scroll+$("#productInfo").height()+50));
			$(".mark").show();
			$("#productInfo").addClass("show").css("bottom",-scroll);
		},
		getShareUrl:function(){
			var p=$.util.getParamAsObject();
			var shareUrl="";
			var me=this;
			var mallQId = "{$quanInfo.qId}";
			var mallUId = "{$quanInfo.uId}";
			if(p.qId||(mallQId&&mallUId)){
				var params={
					"id":"{$id}",
					"fromUserName":"{$userName}",
					"qId":p.qId||mallQId,
					"miUId":p.miUId||mallUId,
					"visitId":shareData.visitId,
					"lastShareUId":shareData.lastShareUId,
					"recommenderId": shareData.lastShareUId,
					saleSourceUid: '{$saleSourceUid}'
				}
			}else{
				var params={
					"id":"{$id}",
					"fromUserName":"{$userName}",
					"visitId":shareData.visitId,
					"lastShareUId":shareData.lastShareUId,
					"recommenderId": shareData.lastShareUId,
					saleSourceUid: '{$saleSourceUid}'
				}
			}
			params=encodeURIComponent(JSON.stringify(params));
			shareUrl=baseUrl+'call.html?customerId={$customerId}&module=product&method=getProduct&params='+params;
			return shareUrl;
		},
		goCart:function(vId){
			var p=$.util.getParamAsObject();
			var params=$.extend(p,{
				"sid":"-1",
				"type":"buy",
				"tplid":"4",
				"mid":4,
				"vId":vId,
				"qId":p.qId||"{$quanInfo.qId}",
				"miUId":p.miUId||"{$quanInfo.miUId}"
			});
			params=encodeURIComponent(JSON.stringify(params));
			location.href = 'call.html?customerId={$customerId}&module=product&method=getCart&params=' + params;
		},
		carInfo:function(){
			var me = this;
			if($("#prop-list dl").length>0 && inventory) {
				var pros = [];
				var prosName = [];
				$("#prop-list dl").each(function (i) {
					$(this).find("span").each(function () {
						if ($(this).hasClass("current")) {
							if (i == 0) {
								size = $(this).data("value");
							}
							if (i == 1) {
								color = $(this).data("value");
							}
							pros.push($(this).data("value"));
							prosName.push($(this).text());
						}
					});
				});
				pros = pros.join("|");
				var key = pid + "|" + pros;
				return me.cartList[key];
			}else{
				return me.cartList[pid];
			}
		},
		selectPrice:function(){
			var me = this;
			$("#free-list").css({"bottom":0,"visibility":"visible"});
			var freeBuy = parseInt('{$freeBuy}');
			if( freeBuy){$("#free-list span.current").removeClass("current");$("#invitation").hide();}
			$("#free-list a").click(function(){
				var freeBuy = parseInt('{$freeBuy}');
				if( freeBuy&&!$("#free-list span").hasClass("current")){$.util.alert("没有选择价格");return;}
				$("#free-list").css("bottom",-$("#free-list").height()+"px");
				$("#free-list").one("webkitTransitionEnd",function(){
					var addCar = document.getElementById("addCar");
					me.addToCart(addCar);
				})
			});
		},
		// 验证输入的数字合法性
		checkNum:function(){
			var reg = /^\+?[1-9][0-9]*$/
			var stockNum = $('#stock-num').text() * 1;
			var buyNum =  $('#buyNum').val();
			// 输入小数时自动向上取整
			if (!reg.test(buyNum)) $('#buyNum').val(Math.ceil(buyNum));
			// 有库存限制，且输入大于库存时自动取最大可购买值，并提示，加号变为不可用
      if (stockNum > 0 && $('#buyNum').val() > stockNum) {
          $('#buyNum').val(stockNum)
          $.util.alert("购买数量不能超过库存限制！");
          $("#plus").addClass("disabled");
      }
			// 输入小于等于1的数减号变为不可用
			if ($('#buyNum').val() <= 1) {
				$("#sub").addClass("disabled");
			}
			// 输入大于等于最大值的数加号变为不可用
			if (stockNum > 0 && $('#buyNum').val() >= stockNum) {
				$("#sub").addClass("disabled");
			}
			// 当数量大于1且小于库存时，将加号、减号重置为可用状态
			if (stockNum > 0 && buyNum > 1 && buyNum < stockNum) {
      	$("#plus").removeClass("disabled");
      	$("#sub").removeClass("disabled");
      } else if (buyNum > 1) {
				$("#plus").removeClass("disabled");
				$("#sub").removeClass("disabled");
			}
		},
		// 失去焦点时验证
		blurCheckNum:function(){
			// 输入小于0的数时重置为1，并提示
			if ($('#buyNum').val() < 1) {
				$('#buyNum').val(1)
				$.util.alert("至少购买一件商品！");
				$("#sub").addClass("disabled");
			}
		},
		addToCart:function() {
			var index = $(".ui-slider-dots .ui-state-active").index();
			var inventory = '{$inventory}';
			var img = $("div.ui-slider img:eq("+index+")");
			var me=this;
			var num = parseInt($("#buyNum").val());
			var p=$.util.getParamAsObject();
			if(!me.selectedSpec()){return;}
			var sizeprop = '{$size}';
			var freeBuy = parseInt('{$freeBuy}');
			if( freeBuy&&!$("#free-list dd").hasClass("current")){$.util.alert("没有选择价格");return;}
			if(sizeprop&&sizeprop!='null') {
				var size = $("#prop-list dl").eq(0).find("dd.current").data("name") || "";
				var color = $("#prop-list dl").eq(1).find("dd.current").data("name") || "";
				if(parseInt(inventory)){
					var key = '';
					var key1 = {$id};
					if (size) {
						key += size;
					}
					if (color) {
						key += "|" + color;
					}
					key1 += "|" + key;
					var availSku = JSON.parse('{$availSku}');
					var nowNum = parseInt(availSku[key].stockCount);
					if (num > nowNum) {
						$.util.alert("购买数量不能超过库存限制");
						return;
					}
					var carPro = me.cartList[key1];
					if (carPro) {
						var carNum = parseInt(carPro.count);
						if (carNum + num > nowNum) {
							$.util.alert("购买数量不能超过库存限制");
							return;
						}
					}
				}
			}
			var freeBuy = "{$freeBuy}";
			var customizedInfo = this.getCustomizedInfo();
			if(!customizedInfo){return;}
			var pa={
				"pid":"{$id}",
				"type":"buy",
				"count":num,
				"size":size,
				"color":color,
				"qId":p.qId||"{$quanInfo.qId}",
				"miUId":p.miUId||"{$quanInfo.uId}",
				"vId":p.vId,
				"shareId":p.sId,
				"shareFormGuid":p.fromGuid || "",
				"visitId":"{$visitId}",
				"customizedInfo":JSON.stringify(customizedInfo)
			};
			if(parseInt(freeBuy)){
				pa.deposit=$("#free-list dd.current").data("value");
			}
			$.req.get("call.json?module=product&customerId={$customerId}&method=updateOrderDetail", {
				userName: "{$userName}",
				params: pa
			},function(data){
				// 登录失效跳到登录页
				if (+data.code === 15 || +data.code === 16) {
					$.util.alert(data.msg)
					setTimeout(function() {
						location.href = baseUrl+'call.html?customerId={$customerId}&module=personCenter&method=login&code=' + data.code + '&redirect_url=' + encodeURIComponent(location.href);
					}, 1000)
				}
				if(!data.code){
					$.util.alert("加入购物车成功");
					mi.PRODUCT_DETAIL.getCartGoodsNum();
					$("#close").click();
				}
			})
		},
		getCustomizedInfo:function(){
			var customizedInfo = [];
			$("#customized li").each(function(){
				var name = $(this).find('.customizedName').html(),
						descrip =  $(this).find('.customizedDescription'),
						description = descrip.val(),
						type = descrip.data('type');
				var other = {};
				if(descrip.data("type")==1){
					description = description.replace("T"," ");
				}else if(descrip.data("type")==6){
					var province=$(this).find('.province input').val()||'',
							city=$(this).find('.city input').val()||'',
							country=$(this).find('.area input').val()||'';
					if((!$(this).find('.province').is(":hidden")&&!province)||(!$(this).find('.city').is(":hidden")&&!city)||(!$(this).find('.area').is(":hidden")&&!country)){
						description = '';
					}else{
						description = province+city+country;
						other = {
							province:province,
							city:city,
							country:country
						}
					}
					if(!description){
						$.util.alert(name+"填写错误");
						$(this).find('.customizedClass').addClass('error');
						customizedInfo = false;
						return false;
					}else{
						$(this).find('.customizedClass').removeClass('error');
					}
				}else if(descrip.data("type")==4){
					if(!(/^1\d{6,10}$/.test(description))){
						description = '';
					}
				}else if(descrip.data("type")==5){
					if(!(/^([a-zA-Z0-9\._-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test(description))){
						description = '';
					}
				}
				if(!description){
					$.util.alert(name+"填写错误");
					$(this).find('.customizedDescription').addClass('error');
					customizedInfo = false;
					return false;
				}else{
					$(this).find('.customizedDescription').removeClass('error');
				}
				customizedInfo.push({
					name:name,
					type:type,
					description:description,
					other:other
				})
			})
			return customizedInfo;
		},
		_initBuy:function(ctrl){
			var me = this;
			var p=$.util.getParamAsObject();
			var data=me.curData;
			if (!$(ctrl).hasClass("btn-disabled")) {
				if ($("#prop-list dl").length != 0) {
					var size = $("#prop-list dd.current").size();
					var sku = me.sku;
					var isValidate = true;
					var sizes = '';
					var colors = '';
					$("#prop-list dl").each(function () {
						if (!$(this).find("dd").hasClass("current")) {
							$.util.alert('请选择' + $(this).find("dt").text());
							isValidate = false;
							return false;
						} else {
							sizes = $("#prop-list dl:eq(0)").find("dd.current").data("name");
							colors = $("#prop-list dl:eq(1)").find("dd.current").data("name");
						}
					});
					if (!isValidate) {
						return false;
					}
				}
				if ($("#free-list").length && !$("#free-list dd").hasClass("current")) {
					$.util.alert('请选择价格');
					return;
				}
				if ($("#stock-num") &&$("#stock-num").html()&& $("#stock-num").html() <= 0) {
					$.util.alert("库存不足");
					return;
				}
				var customizedInfo = this.getCustomizedInfo();
				if(!customizedInfo){return;}
				var params = {
					"pids":$(ctrl).data("id"),
					"sizes": sizes,
					"colors": colors,
					"counts": $("#buyNum").val(),
					"type":"buy",
					"customizedInfo":JSON.stringify(customizedInfo)
				};
				if(window.buyParams) {
					params = $.extend(params, window.buyParams);
				}
				$(ctrl).addClass("btn-disabled");
				$.util.pageLoading.show();
				if (window.freeBuy == "1") {
					if (!$("#free-list dd").hasClass("current")) {
						$.util.alert("没有选择价格");
						return;
					}
					params.deposits = $("#free-list dd.current").data("value");
				}
				if (window.isTeamPro == "1") {
					params.teamBuyType = window.teamBuyType;
				}
				$.req.get("call.json?customerId={$customerId}&module=product&method=preSubmitOrder", {
					params: params
				}, function (data) {
					// 登录失效跳到登录页
					if (+data.code === 15 || +data.code === 16) {
						$.util.alert(data.msg)
						setTimeout(function() {
							location.href = baseUrl+'call.html?customerId={$customerId}&module=personCenter&method=login&code=' + data.code + '&redirect_url=' + encodeURIComponent(location.href);
						}, 1000)
					}
					if (data.hasOwnProperty('code')) {
						$(ctrl).removeClass("btn_disabled").removeClass("btn-disabled");
						// $.util.showMsg(data.msg);
						$.util.pageLoading.hide();
					} else {
						var p = {
							"tplid": 1,
							"id": data.id
						}
						if (window.isTeamPro == "1" && window.teamBuyType == 'team'){
							detail.tuan.createTeamOrder(data.id, function (data) {
								if (data && !data.code) {
									$.util.pageLoading.hide();
									$(ctrl).removeClass("btn_disabled").removeClass("btn-disabled");
									location.href = window.hrefPath + '&module=product&method=getOrderDetail&force=1&params=' + encodeURIComponent(JSON.stringify(p));
								}
							});
						}else{
							$.util.pageLoading.hide();
							$(ctrl).removeClass("btn_disabled").removeClass("btn-disabled");
							location.href = window.hrefPath + '&module=product&method=getOrderDetail&force=1&params=' + encodeURIComponent(JSON.stringify(p));
						}
					}
				});
			}
		}

	}
	detail.init();
	mi.PRODUCT_DETAIL.getCartGoodsNum();
	var shareUrl=detail.getShareUrl();
	wx_share.init({
		"title": decodeURI('{$shareTitle|rawurlencode}') || decodeURI('{$title|rawurlencode}'),
		"desc": decodeURI('{$recommend|rawurlencode}'),
		"link":shareUrl,
		"imgUrl": $.trim($("#shareImg").val()),
		"pkg":{
			"appId": '{$pkg.appId}',
			"timestamp": '{$pkg.timestamp}',
			"nonceStr": '{$pkg.nonceStr}',
			"signature": '{$pkg.signature}'
		},
		success:function(config,shareType){
			var p=$.util.getParamAsObject();
			$.ajax({
				url: baseUrl + "call.json?customerId={$customerId}&module=quan&method=saveShare",
				method: 'get',
				async: false,
				dataType: "json",
				data: {
					params: JSON.stringify({
						"qId":'{$quanInfo.qId}',
						"sId":"{$sId}",
						"guid":detail.guid,
						"miUId":'{$miUId}',
						"shareType":shareType,
						"fromPage":"product_detail",
						"visitId":shareData.visitId,
						"lastShareUId":shareData.lastShareUId,
						saleSourceUid: '{$saleSourceUid}'
					})
				}
			})
		}
	});
	var showImg=function(){

		$('.comnt-img').each(function(){
			var imgs=new Array;
			$(this).children().each(function(){
				var _index=$(this).find('img').attr('src').split('@')[0];
				imgs.push(_index);
			})
			$(this).children().unbind('click');
			$(this).children().click(function(){
				var activeImg=$(this).find('img').attr('src').split('@')[0];
				wx_share.showImg(imgs,activeImg);
			})
		});
	}


</script>
</body></html>
